package initialize

import (
	"gin-wave-im/global"
	"gin-wave-im/model"
	"go.uber.org/zap"
	"gorm.io/gorm"
	"os"
)

func MysqlTables(db *gorm.DB) {
	err := db.AutoMigrate(
		model.User{},
		model.JwtBlacklist{},
		model.Contact{},
		model.Message{},
		model.Community{})
	if err != nil {
		global.GnLog.Error("register table failed", zap.Any("err", err))
		os.Exit(0)
	}
	global.GnLog.Info("register table success")
}